\(\int (e+f x)^2 (a+b \arctan (c+d x))^2 \, dx\) [31]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [B] (verified)
   Fricas [F]
   Sympy [F(-1)]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 20, antiderivative size = 382 \[ \int (e+f x)^2 (a+b \arctan (c+d x))^2 \, dx=\frac {b^2 f^2 x}{3 d^2}-\frac {2 a b f (d e-c f) x}{d^2}-\frac {b^2 f^2 \arctan (c+d x)}{3 d^3}-\frac {2 b^2 f (d e-c f) (c+d x) \arctan (c+d x)}{d^3}-\frac {b f^2 (c+d x)^2 (a+b \arctan (c+d x))}{3 d^3}+\frac {i \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3}-\frac {(d e-c f) \left (d^2 e^2-2 c d e f-\left (3-c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3 f}+\frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}+\frac {2 b \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) (a+b \arctan (c+d x)) \log \left (\frac {2}{1+i (c+d x)}\right )}{3 d^3}+\frac {b^2 f (d e-c f) \log \left (1+(c+d x)^2\right )}{d^3}+\frac {i b^2 \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) \operatorname {PolyLog}\left (2,1-\frac {2}{1+i (c+d x)}\right )}{3 d^3} \]

[Out]

1/3*b^2*f^2*x/d^2-2*a*b*f*(-c*f+d*e)*x/d^2-1/3*b^2*f^2*arctan(d*x+c)/d^3-2*b^2*f*(-c*f+d*e)*(d*x+c)*arctan(d*x
+c)/d^3-1/3*b*f^2*(d*x+c)^2*(a+b*arctan(d*x+c))/d^3+1/3*I*(3*d^2*e^2-6*c*d*e*f-(-3*c^2+1)*f^2)*(a+b*arctan(d*x
+c))^2/d^3-1/3*(-c*f+d*e)*(d^2*e^2-2*c*d*e*f-(-c^2+3)*f^2)*(a+b*arctan(d*x+c))^2/d^3/f+1/3*(f*x+e)^3*(a+b*arct
an(d*x+c))^2/f+2/3*b*(3*d^2*e^2-6*c*d*e*f-(-3*c^2+1)*f^2)*(a+b*arctan(d*x+c))*ln(2/(1+I*(d*x+c)))/d^3+b^2*f*(-
c*f+d*e)*ln(1+(d*x+c)^2)/d^3+1/3*I*b^2*(3*d^2*e^2-6*c*d*e*f-(-3*c^2+1)*f^2)*polylog(2,1-2/(1+I*(d*x+c)))/d^3

Rubi [A] (verified)

Time = 0.41 (sec) , antiderivative size = 382, normalized size of antiderivative = 1.00, number of steps used = 16, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.650, Rules used = {5155, 4974, 4930, 266, 4946, 327, 209, 5104, 5004, 5040, 4964, 2449, 2352} \[ \int (e+f x)^2 (a+b \arctan (c+d x))^2 \, dx=\frac {i \left (-\left (1-3 c^2\right ) f^2-6 c d e f+3 d^2 e^2\right ) (a+b \arctan (c+d x))^2}{3 d^3}-\frac {(d e-c f) \left (-\left (3-c^2\right ) f^2-2 c d e f+d^2 e^2\right ) (a+b \arctan (c+d x))^2}{3 d^3 f}+\frac {2 b \left (-\left (1-3 c^2\right ) f^2-6 c d e f+3 d^2 e^2\right ) \log \left (\frac {2}{1+i (c+d x)}\right ) (a+b \arctan (c+d x))}{3 d^3}-\frac {b f^2 (c+d x)^2 (a+b \arctan (c+d x))}{3 d^3}+\frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}-\frac {2 a b f x (d e-c f)}{d^2}-\frac {2 b^2 f (c+d x) \arctan (c+d x) (d e-c f)}{d^3}-\frac {b^2 f^2 \arctan (c+d x)}{3 d^3}+\frac {i b^2 \left (-\left (1-3 c^2\right ) f^2-6 c d e f+3 d^2 e^2\right ) \operatorname {PolyLog}\left (2,1-\frac {2}{i (c+d x)+1}\right )}{3 d^3}+\frac {b^2 f (d e-c f) \log \left ((c+d x)^2+1\right )}{d^3}+\frac {b^2 f^2 x}{3 d^2} \]

[In]

Int[(e + f*x)^2*(a + b*ArcTan[c + d*x])^2,x]

[Out]

(b^2*f^2*x)/(3*d^2) - (2*a*b*f*(d*e - c*f)*x)/d^2 - (b^2*f^2*ArcTan[c + d*x])/(3*d^3) - (2*b^2*f*(d*e - c*f)*(
c + d*x)*ArcTan[c + d*x])/d^3 - (b*f^2*(c + d*x)^2*(a + b*ArcTan[c + d*x]))/(3*d^3) + ((I/3)*(3*d^2*e^2 - 6*c*
d*e*f - (1 - 3*c^2)*f^2)*(a + b*ArcTan[c + d*x])^2)/d^3 - ((d*e - c*f)*(d^2*e^2 - 2*c*d*e*f - (3 - c^2)*f^2)*(
a + b*ArcTan[c + d*x])^2)/(3*d^3*f) + ((e + f*x)^3*(a + b*ArcTan[c + d*x])^2)/(3*f) + (2*b*(3*d^2*e^2 - 6*c*d*
e*f - (1 - 3*c^2)*f^2)*(a + b*ArcTan[c + d*x])*Log[2/(1 + I*(c + d*x))])/(3*d^3) + (b^2*f*(d*e - c*f)*Log[1 +
(c + d*x)^2])/d^3 + ((I/3)*b^2*(3*d^2*e^2 - 6*c*d*e*f - (1 - 3*c^2)*f^2)*PolyLog[2, 1 - 2/(1 + I*(c + d*x))])/
d^3

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 266

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2352

Int[Log[(c_.)*(x_)]/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[(-e^(-1))*PolyLog[2, 1 - c*x], x] /; FreeQ[{c, d, e
}, x] && EqQ[e + c*d, 0]

Rule 2449

Int[Log[(c_.)/((d_) + (e_.)*(x_))]/((f_) + (g_.)*(x_)^2), x_Symbol] :> Dist[-e/g, Subst[Int[Log[2*d*x]/(1 - 2*
d*x), x], x, 1/(d + e*x)], x] /; FreeQ[{c, d, e, f, g}, x] && EqQ[c, 2*d] && EqQ[e^2*f + d^2*g, 0]

Rule 4930

Int[((a_.) + ArcTan[(c_.)*(x_)^(n_.)]*(b_.))^(p_.), x_Symbol] :> Simp[x*(a + b*ArcTan[c*x^n])^p, x] - Dist[b*c
*n*p, Int[x^n*((a + b*ArcTan[c*x^n])^(p - 1)/(1 + c^2*x^(2*n))), x], x] /; FreeQ[{a, b, c, n}, x] && IGtQ[p, 0
] && (EqQ[n, 1] || EqQ[p, 1])

Rule 4946

Int[((a_.) + ArcTan[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)*((a + b*ArcTan[c*x^
n])^p/(m + 1)), x] - Dist[b*c*n*(p/(m + 1)), Int[x^(m + n)*((a + b*ArcTan[c*x^n])^(p - 1)/(1 + c^2*x^(2*n))),
x], x] /; FreeQ[{a, b, c, m, n}, x] && IGtQ[p, 0] && (EqQ[p, 1] || (EqQ[n, 1] && IntegerQ[m])) && NeQ[m, -1]

Rule 4964

Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symbol] :> Simp[(-(a + b*ArcTan[c*x])^p)*(
Log[2/(1 + e*(x/d))]/e), x] + Dist[b*c*(p/e), Int[(a + b*ArcTan[c*x])^(p - 1)*(Log[2/(1 + e*(x/d))]/(1 + c^2*x
^2)), x], x] /; FreeQ[{a, b, c, d, e}, x] && IGtQ[p, 0] && EqQ[c^2*d^2 + e^2, 0]

Rule 4974

Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))^(p_)*((d_) + (e_.)*(x_))^(q_.), x_Symbol] :> Simp[(d + e*x)^(q + 1)*((a
 + b*ArcTan[c*x])^p/(e*(q + 1))), x] - Dist[b*c*(p/(e*(q + 1))), Int[ExpandIntegrand[(a + b*ArcTan[c*x])^(p -
1), (d + e*x)^(q + 1)/(1 + c^2*x^2), x], x], x] /; FreeQ[{a, b, c, d, e}, x] && IGtQ[p, 1] && IntegerQ[q] && N
eQ[q, -1]

Rule 5004

Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)^2), x_Symbol] :> Simp[(a + b*ArcTan[c*x])^(p +
 1)/(b*c*d*(p + 1)), x] /; FreeQ[{a, b, c, d, e, p}, x] && EqQ[e, c^2*d] && NeQ[p, -1]

Rule 5040

Int[(((a_.) + ArcTan[(c_.)*(x_)]*(b_.))^(p_.)*(x_))/((d_) + (e_.)*(x_)^2), x_Symbol] :> Simp[(-I)*((a + b*ArcT
an[c*x])^(p + 1)/(b*e*(p + 1))), x] - Dist[1/(c*d), Int[(a + b*ArcTan[c*x])^p/(I - c*x), x], x] /; FreeQ[{a, b
, c, d, e}, x] && EqQ[e, c^2*d] && IGtQ[p, 0]

Rule 5104

Int[(((a_.) + ArcTan[(c_.)*(x_)]*(b_.))^(p_.)*((f_) + (g_.)*(x_))^(m_.))/((d_) + (e_.)*(x_)^2), x_Symbol] :> I
nt[ExpandIntegrand[(a + b*ArcTan[c*x])^p/(d + e*x^2), (f + g*x)^m, x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] &
& IGtQ[p, 0] && EqQ[e, c^2*d] && IGtQ[m, 0]

Rule 5155

Int[((a_.) + ArcTan[(c_) + (d_.)*(x_)]*(b_.))^(p_.)*((e_.) + (f_.)*(x_))^(m_.), x_Symbol] :> Dist[1/d, Subst[I
nt[((d*e - c*f)/d + f*(x/d))^m*(a + b*ArcTan[x])^p, x], x, c + d*x], x] /; FreeQ[{a, b, c, d, e, f, m, p}, x]
&& IGtQ[p, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \left (\frac {d e-c f}{d}+\frac {f x}{d}\right )^2 (a+b \arctan (x))^2 \, dx,x,c+d x\right )}{d} \\ & = \frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}-\frac {(2 b) \text {Subst}\left (\int \left (\frac {3 f^2 (d e-c f) (a+b \arctan (x))}{d^3}+\frac {f^3 x (a+b \arctan (x))}{d^3}+\frac {\left ((d e-c f) \left (d^2 e^2-2 c d e f-3 f^2+c^2 f^2\right )+f \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) x\right ) (a+b \arctan (x))}{d^3 \left (1+x^2\right )}\right ) \, dx,x,c+d x\right )}{3 f} \\ & = \frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}-\frac {(2 b) \text {Subst}\left (\int \frac {\left ((d e-c f) \left (d^2 e^2-2 c d e f-3 f^2+c^2 f^2\right )+f \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) x\right ) (a+b \arctan (x))}{1+x^2} \, dx,x,c+d x\right )}{3 d^3 f}-\frac {\left (2 b f^2\right ) \text {Subst}(\int x (a+b \arctan (x)) \, dx,x,c+d x)}{3 d^3}-\frac {(2 b f (d e-c f)) \text {Subst}(\int (a+b \arctan (x)) \, dx,x,c+d x)}{d^3} \\ & = -\frac {2 a b f (d e-c f) x}{d^2}-\frac {b f^2 (c+d x)^2 (a+b \arctan (c+d x))}{3 d^3}+\frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}-\frac {(2 b) \text {Subst}\left (\int \left (\frac {(d e-c f) \left (d^2 e^2-2 c d e f-\left (3-c^2\right ) f^2\right ) (a+b \arctan (x))}{1+x^2}+\frac {f \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) x (a+b \arctan (x))}{1+x^2}\right ) \, dx,x,c+d x\right )}{3 d^3 f}+\frac {\left (b^2 f^2\right ) \text {Subst}\left (\int \frac {x^2}{1+x^2} \, dx,x,c+d x\right )}{3 d^3}-\frac {\left (2 b^2 f (d e-c f)\right ) \text {Subst}(\int \arctan (x) \, dx,x,c+d x)}{d^3} \\ & = \frac {b^2 f^2 x}{3 d^2}-\frac {2 a b f (d e-c f) x}{d^2}-\frac {2 b^2 f (d e-c f) (c+d x) \arctan (c+d x)}{d^3}-\frac {b f^2 (c+d x)^2 (a+b \arctan (c+d x))}{3 d^3}+\frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}-\frac {\left (b^2 f^2\right ) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,c+d x\right )}{3 d^3}+\frac {\left (2 b^2 f (d e-c f)\right ) \text {Subst}\left (\int \frac {x}{1+x^2} \, dx,x,c+d x\right )}{d^3}-\frac {\left (2 b \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right )\right ) \text {Subst}\left (\int \frac {x (a+b \arctan (x))}{1+x^2} \, dx,x,c+d x\right )}{3 d^3}-\frac {\left (2 b (d e-c f) \left (d^2 e^2-2 c d e f-\left (3-c^2\right ) f^2\right )\right ) \text {Subst}\left (\int \frac {a+b \arctan (x)}{1+x^2} \, dx,x,c+d x\right )}{3 d^3 f} \\ & = \frac {b^2 f^2 x}{3 d^2}-\frac {2 a b f (d e-c f) x}{d^2}-\frac {b^2 f^2 \arctan (c+d x)}{3 d^3}-\frac {2 b^2 f (d e-c f) (c+d x) \arctan (c+d x)}{d^3}-\frac {b f^2 (c+d x)^2 (a+b \arctan (c+d x))}{3 d^3}+\frac {i \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3}-\frac {(d e-c f) \left (d^2 e^2-2 c d e f-\left (3-c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3 f}+\frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}+\frac {b^2 f (d e-c f) \log \left (1+(c+d x)^2\right )}{d^3}+\frac {\left (2 b \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right )\right ) \text {Subst}\left (\int \frac {a+b \arctan (x)}{i-x} \, dx,x,c+d x\right )}{3 d^3} \\ & = \frac {b^2 f^2 x}{3 d^2}-\frac {2 a b f (d e-c f) x}{d^2}-\frac {b^2 f^2 \arctan (c+d x)}{3 d^3}-\frac {2 b^2 f (d e-c f) (c+d x) \arctan (c+d x)}{d^3}-\frac {b f^2 (c+d x)^2 (a+b \arctan (c+d x))}{3 d^3}+\frac {i \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3}-\frac {(d e-c f) \left (d^2 e^2-2 c d e f-\left (3-c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3 f}+\frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}+\frac {2 b \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) (a+b \arctan (c+d x)) \log \left (\frac {2}{1+i (c+d x)}\right )}{3 d^3}+\frac {b^2 f (d e-c f) \log \left (1+(c+d x)^2\right )}{d^3}-\frac {\left (2 b^2 \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right )\right ) \text {Subst}\left (\int \frac {\log \left (\frac {2}{1+i x}\right )}{1+x^2} \, dx,x,c+d x\right )}{3 d^3} \\ & = \frac {b^2 f^2 x}{3 d^2}-\frac {2 a b f (d e-c f) x}{d^2}-\frac {b^2 f^2 \arctan (c+d x)}{3 d^3}-\frac {2 b^2 f (d e-c f) (c+d x) \arctan (c+d x)}{d^3}-\frac {b f^2 (c+d x)^2 (a+b \arctan (c+d x))}{3 d^3}+\frac {i \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3}-\frac {(d e-c f) \left (d^2 e^2-2 c d e f-\left (3-c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3 f}+\frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}+\frac {2 b \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) (a+b \arctan (c+d x)) \log \left (\frac {2}{1+i (c+d x)}\right )}{3 d^3}+\frac {b^2 f (d e-c f) \log \left (1+(c+d x)^2\right )}{d^3}+\frac {\left (2 i b^2 \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right )\right ) \text {Subst}\left (\int \frac {\log (2 x)}{1-2 x} \, dx,x,\frac {1}{1+i (c+d x)}\right )}{3 d^3} \\ & = \frac {b^2 f^2 x}{3 d^2}-\frac {2 a b f (d e-c f) x}{d^2}-\frac {b^2 f^2 \arctan (c+d x)}{3 d^3}-\frac {2 b^2 f (d e-c f) (c+d x) \arctan (c+d x)}{d^3}-\frac {b f^2 (c+d x)^2 (a+b \arctan (c+d x))}{3 d^3}+\frac {i \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3}-\frac {(d e-c f) \left (d^2 e^2-2 c d e f-\left (3-c^2\right ) f^2\right ) (a+b \arctan (c+d x))^2}{3 d^3 f}+\frac {(e+f x)^3 (a+b \arctan (c+d x))^2}{3 f}+\frac {2 b \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) (a+b \arctan (c+d x)) \log \left (\frac {2}{1+i (c+d x)}\right )}{3 d^3}+\frac {b^2 f (d e-c f) \log \left (1+(c+d x)^2\right )}{d^3}+\frac {i b^2 \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) \operatorname {PolyLog}\left (2,1-\frac {2}{1+i (c+d x)}\right )}{3 d^3} \\ \end{align*}

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(801\) vs. \(2(382)=764\).

Time = 7.96 (sec) , antiderivative size = 801, normalized size of antiderivative = 2.10 \[ \int (e+f x)^2 (a+b \arctan (c+d x))^2 \, dx=a^2 e^2 x+a^2 e f x^2+\frac {1}{3} a^2 f^2 x^3+\frac {a b \left (-d f x (6 d e-4 c f+d f x)+2 \left (3 d e f-3 c^2 d e f+c^3 f^2+3 c \left (d^2 e^2-f^2\right )+d^3 x \left (3 e^2+3 e f x+f^2 x^2\right )\right ) \arctan (c+d x)+\left (-3 d^2 e^2+6 c d e f+\left (1-3 c^2\right ) f^2\right ) \log \left (1+(c+d x)^2\right )\right )}{3 d^3}+\frac {b^2 e^2 \left (\arctan (c+d x) \left ((-i+c+d x) \arctan (c+d x)+2 \log \left (1+e^{2 i \arctan (c+d x)}\right )\right )-i \operatorname {PolyLog}\left (2,-e^{2 i \arctan (c+d x)}\right )\right )}{d}+\frac {b^2 e f \left (\left (1+2 i c-c^2+d^2 x^2\right ) \arctan (c+d x)^2-2 \arctan (c+d x) \left (c+d x+2 c \log \left (1+e^{2 i \arctan (c+d x)}\right )\right )+\log \left (1+(c+d x)^2\right )+2 i c \operatorname {PolyLog}\left (2,-e^{2 i \arctan (c+d x)}\right )\right )}{d^2}+\frac {b^2 f^2 \left (1+(c+d x)^2\right )^{3/2} \left (\frac {c+d x}{\sqrt {1+(c+d x)^2}}+\frac {6 c (c+d x) \arctan (c+d x)}{\sqrt {1+(c+d x)^2}}+\frac {3 (c+d x) \arctan (c+d x)^2}{\sqrt {1+(c+d x)^2}}+\frac {3 c^2 (c+d x) \arctan (c+d x)^2}{\sqrt {1+(c+d x)^2}}+i \arctan (c+d x)^2 \cos (3 \arctan (c+d x))-3 i c^2 \arctan (c+d x)^2 \cos (3 \arctan (c+d x))-2 \arctan (c+d x) \cos (3 \arctan (c+d x)) \log \left (1+e^{2 i \arctan (c+d x)}\right )+6 c^2 \arctan (c+d x) \cos (3 \arctan (c+d x)) \log \left (1+e^{2 i \arctan (c+d x)}\right )+6 c \cos (3 \arctan (c+d x)) \log \left (\frac {1}{\sqrt {1+(c+d x)^2}}\right )+\frac {\left (3 i-12 c-9 i c^2\right ) \arctan (c+d x)^2+2 \arctan (c+d x) \left (-2+\left (-3+9 c^2\right ) \log \left (1+e^{2 i \arctan (c+d x)}\right )\right )+18 c \log \left (\frac {1}{\sqrt {1+(c+d x)^2}}\right )}{\sqrt {1+(c+d x)^2}}-\frac {4 i \left (-1+3 c^2\right ) \operatorname {PolyLog}\left (2,-e^{2 i \arctan (c+d x)}\right )}{\left (1+(c+d x)^2\right )^{3/2}}+\sin (3 \arctan (c+d x))+6 c \arctan (c+d x) \sin (3 \arctan (c+d x))-\arctan (c+d x)^2 \sin (3 \arctan (c+d x))+3 c^2 \arctan (c+d x)^2 \sin (3 \arctan (c+d x))\right )}{12 d^3} \]

[In]

Integrate[(e + f*x)^2*(a + b*ArcTan[c + d*x])^2,x]

[Out]

a^2*e^2*x + a^2*e*f*x^2 + (a^2*f^2*x^3)/3 + (a*b*(-(d*f*x*(6*d*e - 4*c*f + d*f*x)) + 2*(3*d*e*f - 3*c^2*d*e*f
+ c^3*f^2 + 3*c*(d^2*e^2 - f^2) + d^3*x*(3*e^2 + 3*e*f*x + f^2*x^2))*ArcTan[c + d*x] + (-3*d^2*e^2 + 6*c*d*e*f
 + (1 - 3*c^2)*f^2)*Log[1 + (c + d*x)^2]))/(3*d^3) + (b^2*e^2*(ArcTan[c + d*x]*((-I + c + d*x)*ArcTan[c + d*x]
 + 2*Log[1 + E^((2*I)*ArcTan[c + d*x])]) - I*PolyLog[2, -E^((2*I)*ArcTan[c + d*x])]))/d + (b^2*e*f*((1 + (2*I)
*c - c^2 + d^2*x^2)*ArcTan[c + d*x]^2 - 2*ArcTan[c + d*x]*(c + d*x + 2*c*Log[1 + E^((2*I)*ArcTan[c + d*x])]) +
 Log[1 + (c + d*x)^2] + (2*I)*c*PolyLog[2, -E^((2*I)*ArcTan[c + d*x])]))/d^2 + (b^2*f^2*(1 + (c + d*x)^2)^(3/2
)*((c + d*x)/Sqrt[1 + (c + d*x)^2] + (6*c*(c + d*x)*ArcTan[c + d*x])/Sqrt[1 + (c + d*x)^2] + (3*(c + d*x)*ArcT
an[c + d*x]^2)/Sqrt[1 + (c + d*x)^2] + (3*c^2*(c + d*x)*ArcTan[c + d*x]^2)/Sqrt[1 + (c + d*x)^2] + I*ArcTan[c
+ d*x]^2*Cos[3*ArcTan[c + d*x]] - (3*I)*c^2*ArcTan[c + d*x]^2*Cos[3*ArcTan[c + d*x]] - 2*ArcTan[c + d*x]*Cos[3
*ArcTan[c + d*x]]*Log[1 + E^((2*I)*ArcTan[c + d*x])] + 6*c^2*ArcTan[c + d*x]*Cos[3*ArcTan[c + d*x]]*Log[1 + E^
((2*I)*ArcTan[c + d*x])] + 6*c*Cos[3*ArcTan[c + d*x]]*Log[1/Sqrt[1 + (c + d*x)^2]] + ((3*I - 12*c - (9*I)*c^2)
*ArcTan[c + d*x]^2 + 2*ArcTan[c + d*x]*(-2 + (-3 + 9*c^2)*Log[1 + E^((2*I)*ArcTan[c + d*x])]) + 18*c*Log[1/Sqr
t[1 + (c + d*x)^2]])/Sqrt[1 + (c + d*x)^2] - ((4*I)*(-1 + 3*c^2)*PolyLog[2, -E^((2*I)*ArcTan[c + d*x])])/(1 +
(c + d*x)^2)^(3/2) + Sin[3*ArcTan[c + d*x]] + 6*c*ArcTan[c + d*x]*Sin[3*ArcTan[c + d*x]] - ArcTan[c + d*x]^2*S
in[3*ArcTan[c + d*x]] + 3*c^2*ArcTan[c + d*x]^2*Sin[3*ArcTan[c + d*x]]))/(12*d^3)

Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 1017 vs. \(2 (362 ) = 724\).

Time = 0.67 (sec) , antiderivative size = 1018, normalized size of antiderivative = 2.66

method result size
parts \(\text {Expression too large to display}\) \(1018\)
derivativedivides \(\text {Expression too large to display}\) \(1042\)
default \(\text {Expression too large to display}\) \(1042\)
risch \(\text {Expression too large to display}\) \(2416\)

[In]

int((f*x+e)^2*(a+b*arctan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/3*a^2*(f*x+e)^3/f+b^2/d*(1/3/d^2*f^2*arctan(d*x+c)^2*(d*x+c)^3-1/d^2*f^2*arctan(d*x+c)^2*(d*x+c)^2*c+1/d*f*a
rctan(d*x+c)^2*(d*x+c)^2*e+1/d^2*f^2*arctan(d*x+c)^2*(d*x+c)*c^2-2/d*f*arctan(d*x+c)^2*(d*x+c)*c*e+arctan(d*x+
c)^2*(d*x+c)*e^2-1/3/d^2*f^2*arctan(d*x+c)^2*c^3+1/d*f*arctan(d*x+c)^2*c^2*e-arctan(d*x+c)^2*c*e^2+1/3*d/f*arc
tan(d*x+c)^2*e^3-2/3/d^2/f*(1/2*arctan(d*x+c)*f^3*(d*x+c)^2-3*arctan(d*x+c)*c*f^3*(d*x+c)+3*arctan(d*x+c)*d*e*
f^2*(d*x+c)+3/2*arctan(d*x+c)*ln(1+(d*x+c)^2)*c^2*f^3-3*arctan(d*x+c)*ln(1+(d*x+c)^2)*c*d*e*f^2+3/2*arctan(d*x
+c)*ln(1+(d*x+c)^2)*d^2*e^2*f-1/2*arctan(d*x+c)*ln(1+(d*x+c)^2)*f^3-arctan(d*x+c)^2*c^3*f^3+3*arctan(d*x+c)^2*
c^2*d*e*f^2-3*arctan(d*x+c)^2*c*d^2*e^2*f+arctan(d*x+c)^2*d^3*e^3+3*arctan(d*x+c)^2*c*f^3-3*arctan(d*x+c)^2*d*
e*f^2-1/2*f^2*(f*(d*x+c)+1/2*(-6*c*f+6*d*e)*ln(1+(d*x+c)^2)-f*arctan(d*x+c))-1/2*f*(3*c^2*f^2-6*c*d*e*f+3*d^2*
e^2-f^2)*(-1/2*I*(ln(d*x+c-I)*ln(1+(d*x+c)^2)-1/2*ln(d*x+c-I)^2-dilog(-1/2*I*(d*x+c+I))-ln(d*x+c-I)*ln(-1/2*I*
(d*x+c+I)))+1/2*I*(ln(d*x+c+I)*ln(1+(d*x+c)^2)-1/2*ln(d*x+c+I)^2-dilog(1/2*I*(d*x+c-I))-ln(d*x+c+I)*ln(1/2*I*(
d*x+c-I))))-1/4*(-2*c^3*f^3+6*c^2*d*e*f^2-6*c*d^2*e^2*f+2*d^3*e^3+6*c*f^3-6*d*e*f^2)*arctan(d*x+c)^2))+1/3*a*b
/d^3*f^2*ln(1+(d*x+c)^2)+2/d*a*b*c*e^2*arctan(d*x+c)+2/3/d^3*f^2*b*a*c^3*arctan(d*x+c)+4/3/d^2*c*f^2*x*b*a-2/d
*e*x*f*b*a-a*b/d^3*f^2*ln(1+(d*x+c)^2)*c^2-a*b/d*ln(1+(d*x+c)^2)*e^2-2/d^3*c*f^2*b*a*arctan(d*x+c)-1/3/d*f^2*b
*a*x^2-2*b/d^2*arctan(d*x+c)*a*c^2*e*f+2*a*b/d^2*f*ln(1+(d*x+c)^2)*c*e+2*a*b*f*arctan(d*x+c)*e*x^2-2/d^2*c*f*e
*b*a+5/3/d^3*c^2*f^2*b*a+2/d^2*e*f*b*a*arctan(d*x+c)+2/3*a*b*f^2*arctan(d*x+c)*x^3+2*a*b*arctan(d*x+c)*x*e^2

Fricas [F]

\[ \int (e+f x)^2 (a+b \arctan (c+d x))^2 \, dx=\int { {\left (f x + e\right )}^{2} {\left (b \arctan \left (d x + c\right ) + a\right )}^{2} \,d x } \]

[In]

integrate((f*x+e)^2*(a+b*arctan(d*x+c))^2,x, algorithm="fricas")

[Out]

integral(a^2*f^2*x^2 + 2*a^2*e*f*x + a^2*e^2 + (b^2*f^2*x^2 + 2*b^2*e*f*x + b^2*e^2)*arctan(d*x + c)^2 + 2*(a*
b*f^2*x^2 + 2*a*b*e*f*x + a*b*e^2)*arctan(d*x + c), x)

Sympy [F(-1)]

Timed out. \[ \int (e+f x)^2 (a+b \arctan (c+d x))^2 \, dx=\text {Timed out} \]

[In]

integrate((f*x+e)**2*(a+b*atan(d*x+c))**2,x)

[Out]

Timed out

Maxima [F]

\[ \int (e+f x)^2 (a+b \arctan (c+d x))^2 \, dx=\int { {\left (f x + e\right )}^{2} {\left (b \arctan \left (d x + c\right ) + a\right )}^{2} \,d x } \]

[In]

integrate((f*x+e)^2*(a+b*arctan(d*x+c))^2,x, algorithm="maxima")

[Out]

3/4*b^2*c^2*e^2*arctan(d*x + c)^2*arctan((d^2*x + c*d)/d)/d - 1/4*(3*arctan(d*x + c)*arctan((d^2*x + c*d)/d)^2
/d - arctan((d^2*x + c*d)/d)^3/d)*b^2*c^2*e^2 + 1/3*a^2*f^2*x^3 + 36*b^2*d^2*f^2*integrate(1/48*x^4*arctan(d*x
 + c)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 3*b^2*d^2*f^2*integrate(1/48*x^4*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^
2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 72*b^2*d^2*e*f*integrate(1/48*x^3*arctan(d*x + c)^2/(d^2*x^2 + 2*c*d*x +
 c^2 + 1), x) + 72*b^2*c*d*f^2*integrate(1/48*x^3*arctan(d*x + c)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 4*b^2*
d^2*f^2*integrate(1/48*x^4*log(d^2*x^2 + 2*c*d*x + c^2 + 1)/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 6*b^2*d^2*e*f*
integrate(1/48*x^3*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 6*b^2*c*d*f^2*integr
ate(1/48*x^3*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 36*b^2*d^2*e^2*integrate(1
/48*x^2*arctan(d*x + c)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 144*b^2*c*d*e*f*integrate(1/48*x^2*arctan(d*x +
c)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 36*b^2*c^2*f^2*integrate(1/48*x^2*arctan(d*x + c)^2/(d^2*x^2 + 2*c*d*
x + c^2 + 1), x) + 12*b^2*d^2*e*f*integrate(1/48*x^3*log(d^2*x^2 + 2*c*d*x + c^2 + 1)/(d^2*x^2 + 2*c*d*x + c^2
 + 1), x) + 4*b^2*c*d*f^2*integrate(1/48*x^3*log(d^2*x^2 + 2*c*d*x + c^2 + 1)/(d^2*x^2 + 2*c*d*x + c^2 + 1), x
) + 3*b^2*d^2*e^2*integrate(1/48*x^2*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 12
*b^2*c*d*e*f*integrate(1/48*x^2*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 3*b^2*c
^2*f^2*integrate(1/48*x^2*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 72*b^2*c*d*e^
2*integrate(1/48*x*arctan(d*x + c)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 72*b^2*c^2*e*f*integrate(1/48*x*arcta
n(d*x + c)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 12*b^2*d^2*e^2*integrate(1/48*x^2*log(d^2*x^2 + 2*c*d*x + c^2
 + 1)/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 12*b^2*c*d*e*f*integrate(1/48*x^2*log(d^2*x^2 + 2*c*d*x + c^2 + 1)/(
d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 6*b^2*c*d*e^2*integrate(1/48*x*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2
+ 2*c*d*x + c^2 + 1), x) + 6*b^2*c^2*e*f*integrate(1/48*x*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*
x + c^2 + 1), x) + 12*b^2*c*d*e^2*integrate(1/48*x*log(d^2*x^2 + 2*c*d*x + c^2 + 1)/(d^2*x^2 + 2*c*d*x + c^2 +
 1), x) + 3*b^2*c^2*e^2*integrate(1/48*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) +
a^2*e*f*x^2 + 3/4*b^2*e^2*arctan(d*x + c)^2*arctan((d^2*x + c*d)/d)/d - 8*b^2*d*f^2*integrate(1/48*x^3*arctan(
d*x + c)/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) - 24*b^2*d*e*f*integrate(1/48*x^2*arctan(d*x + c)/(d^2*x^2 + 2*c*d*
x + c^2 + 1), x) - 24*b^2*d*e^2*integrate(1/48*x*arctan(d*x + c)/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) - 1/4*(3*ar
ctan(d*x + c)*arctan((d^2*x + c*d)/d)^2/d - arctan((d^2*x + c*d)/d)^3/d)*b^2*e^2 + 2*(x^2*arctan(d*x + c) - d*
(x/d^2 + (c^2 - 1)*arctan((d^2*x + c*d)/d)/d^3 - c*log(d^2*x^2 + 2*c*d*x + c^2 + 1)/d^3))*a*b*e*f + 1/3*(2*x^3
*arctan(d*x + c) - d*((d*x^2 - 4*c*x)/d^3 - 2*(c^3 - 3*c)*arctan((d^2*x + c*d)/d)/d^4 + (3*c^2 - 1)*log(d^2*x^
2 + 2*c*d*x + c^2 + 1)/d^4))*a*b*f^2 + a^2*e^2*x + 36*b^2*f^2*integrate(1/48*x^2*arctan(d*x + c)^2/(d^2*x^2 +
2*c*d*x + c^2 + 1), x) + 3*b^2*f^2*integrate(1/48*x^2*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*x +
c^2 + 1), x) + 72*b^2*e*f*integrate(1/48*x*arctan(d*x + c)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 6*b^2*e*f*int
egrate(1/48*x*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + 3*b^2*e^2*integrate(1/48*
log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2/(d^2*x^2 + 2*c*d*x + c^2 + 1), x) + (2*(d*x + c)*arctan(d*x + c) - log((d*x
 + c)^2 + 1))*a*b*e^2/d + 1/12*(b^2*f^2*x^3 + 3*b^2*e*f*x^2 + 3*b^2*e^2*x)*arctan(d*x + c)^2 - 1/48*(b^2*f^2*x
^3 + 3*b^2*e*f*x^2 + 3*b^2*e^2*x)*log(d^2*x^2 + 2*c*d*x + c^2 + 1)^2

Giac [F]

\[ \int (e+f x)^2 (a+b \arctan (c+d x))^2 \, dx=\int { {\left (f x + e\right )}^{2} {\left (b \arctan \left (d x + c\right ) + a\right )}^{2} \,d x } \]

[In]

integrate((f*x+e)^2*(a+b*arctan(d*x+c))^2,x, algorithm="giac")

[Out]

sage0*x

Mupad [F(-1)]

Timed out. \[ \int (e+f x)^2 (a+b \arctan (c+d x))^2 \, dx=\int {\left (e+f\,x\right )}^2\,{\left (a+b\,\mathrm {atan}\left (c+d\,x\right )\right )}^2 \,d x \]

[In]

int((e + f*x)^2*(a + b*atan(c + d*x))^2,x)

[Out]

int((e + f*x)^2*(a + b*atan(c + d*x))^2, x)